﻿/* Nibiru Studio Engine Version [1062] */
#pragma once
#include "SharedPointer.h"
#include "Apis/NEngineApi.h"
#include "Platform/Android/JNI/NAndroidJavaObject.h"
#include "EyeModel.h"


ENGINE_NAMESPACE_BEGIN

#define EyeManager_API DLLEXPORT

class EyeManager_API EyeManager
{
    DECLARE_RTTI
public:
    static EyeManager* instance();
    virtual ~EyeManager() = default;
private:
    EyeManager();

public:
    ServiceResult start();
    ServiceResult stop();
    ServiceResult getEyeData(EyeDataBasic &eyedDataBasic);
    // calibration
    ServiceResult startCalibration(float minX, float maxX, float minY, float maxY, int calibCount);
    ServiceResult startCalibrationPoint(int index, float leftX, float leftY, float rightX, float rightY);
    ServiceResult cancelCalibrationPoint();
    ServiceResult completeCalibration();
    // calibration percent
    int getCalibPercent();
    int getCalibFinishCode();
    // debug
    ServiceResult saveImage(const string& imageName);
    ServiceResult registerImageCallback();
    ServiceResult unregisterImageCallback();


private:
    string getErrorMsg();
    void stringToEyeDataBasic(const string& eyeDataStr, EyeDataBasic& eyeDataBasic);


private:
    NAndroidJavaObjectPtr m_trackerApi;

    //
    EyeDataBasic m_emptyEyeData;

};

ENGINE_NAMESPACE_END
